import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nyh_motorcade_app/styles/colors.dart';
import 'package:nyh_motorcade_app/widgets/custom_app_bar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:nyh_motorcade_app/widgets/multi_state/multi_state_widget.dart';
import 'contact_us_controller.dart';

class ContactUsPage extends StatelessWidget {
  final controller = Get.put(ContactUsController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colours.color_background,
      appBar: CustomAppBar(context: context, title: "联系我们"),
      body: GetBuilder<ContactUsController>(
        builder: (controller) {
          return MultiStateWidget(
            child: SingleChildScrollView(
              physics: BouncingScrollPhysics(),
              child: Column(
                children: [
                  Container(
                    height: 181.w,
                    child: Center(
                      child: Image.asset("images/ic_logo_contact_us.png"),
                    ),
                  ),
                  buildItemWidget("客服电话", controller.servicePhone),
                  buildItemWidget("网址", controller.websiteAddress),
                  buildItemWidget("地址", controller.companyAddress),
                  SizedBox(height: 12.w),
                  buildItemWidget("专属BD顾问", controller.exclusiveAdviser),
                  buildItemWidget("联系电话", controller.contactPhone),
                  Padding(
                    padding: EdgeInsets.only(left: 16.w, top: 16.w, right: 12.w, bottom: 100.w),
                    child: Text(
                      "1.为了给您提供高效精准的企业服务，在使用产品遇到问题时可直接咨询专属BD顾问; \n2.若专属BD顾问无法为您提供服务，请通过客服电话与我们联系。",
                      style: TextStyle(color: Colours.color_9fa0ab, fontSize: 12.sp, height: 1.5),
                    ),
                  ),
                ],
              ),
            ),
            state: controller.multiState,
            onRetry: () {
              controller.onRetry();
            },
          );
        },
      ),
    );
  }

  Widget buildItemWidget(String title, String content) {
    return Container(
      color: Colours.color_white,
      height: 48.w,
      child: Material(
        child: InkWell(
          onTap: () {
            switch (title) {
              case "客服电话":
                break;
              case "网址":
                break;
              case "地址":
                break;
              case "联系电话":
                break;
              default:
            }
          },
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 16.w),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  title,
                  style: TextStyle(
                    color: Colours.color_6f7082,
                    fontSize: 14.sp,
                  ),
                ),
                SizedBox(
                  width: 50.w,
                ),
                Expanded(
                  child: Text(
                    content,
                    style: TextStyle(
                      color: Colours.color_text_theme,
                      fontSize: 14.sp,
                    ),
                    textAlign: TextAlign.right,
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
